package edu.hawaii.stack.page;

import org.apache.wicket.Request;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebSession;
import edu.hawaii.stack.Stack;

/**
 * A session created for each user.
 * 
 * @author Aric West
 */
public class StackSession extends WebSession {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;
  /** The stack being used for this session.  Final because of PMD complains, however this
   * troubles me.
   */
  private final Stack stack = new Stack();
  /** The input text. */
  private String inputField = "";
  
  /**
   * Create a new session for this user. Called automatically by wicket. You always need to define
   * this constructor when implementing your own application-specific Session class.
   * 
   * @param application This application.
   * @param request The request.
   */
  public StackSession(WebApplication application, Request request) {
    super(request);
  }

  /**
   * Return the stack for this session.
   * 
   * @return The stack for this session.
   */
  public Stack getStack() {
    return this.stack;
  }

  /**
   * Gets the current input field value.
   * 
   * @return The current input field value.
   */
  public String getInput() {
    return this.inputField;
  }
  
  /**
   * Sets the value of the current session's input field.
   * 
   * @param newInputField The new input value.
   */
  public void setInput(String newInputField) {
    this.inputField = newInputField;
  }
}
